﻿#region Includes
using System;
using System.Runtime.InteropServices;
#endregion

namespace GingerGL.Graphics.Models.BSP
{
    //------------------------------------------------------------//
    /// <summary>
    /// leaf of bsp tree as found in file
    /// </summary>
    [StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Ansi)]
    public struct BSPLeaf
    {
        //--------------------------------------------------------//
        #region Variables
        public Int32 Cluster;	        //cluster index for visdata
        public Int32 Area;		        //areaportal area
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
        public Int32[] Mins;	        //min x,y,z (bounding box)
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
        public Int32[] Maxs;
        public Int32 FirstLeafFace;	    //first index in leafFaces array
        public Int32 NumFaces;
        public Int32 FirstLeafBrush;	//first index into leaf brushes array
        public Int32 NumBrushes;

        static public readonly int SizeInBytes = sizeof(int) * 12;
        #endregion
        //--------------------------------------------------------//
    }
    //------------------------------------------------------------//
}
